import java.util.TreeMap;

public class Demo3TreeMap {

    public static void main(String[] args) {

        Student s1=new Student("蒋恬",202);
        Student s2=new Student("陈海圣",203);
        Student s3=new Student("小蒋恬",204);

        TreeMap <Student,String> treeMap=new TreeMap<>();
        treeMap.put(s1,"北京");
        treeMap.put(s2,"北京");
        treeMap.put(s3,"北京");
        treeMap.put(s3,"北京");
        System.out.println(treeMap);

        treeMap.remove(s3);
        System.out.println(treeMap);

        System.out.println("遍历");
        for (Object object :
                treeMap.keySet()) {
            System.out.println(object+"---"+treeMap.get(object));
        }

        //判断
        System.out.println(treeMap.containsKey(s2));
        System.out.println(treeMap.containsValue("南京"));
    }
}
